package com.origin.src.lazy;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;


@Configuration
@ComponentScan
@EnableAspectJAutoProxy
public class LazyApplication {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(LazyApplication.class);
        LazyA lazyA = applicationContext.getBean(LazyA.class);
        System.out.println(lazyA.lazyB.application);
        lazyA.lazyB.to();
        System.out.println(lazyA.lazyB.application);
        LazyB lazyB = applicationContext.getBean(LazyB.class);
        System.out.println(lazyB == lazyA.lazyB);
        System.out.println(lazyB.application);

    }
}
